import {createAPI,createParamsAPI,createFileAPI,createFormAPI} from '@/utils/http'


export const getListData = data => createFormAPI('/contest/search', 'post', data)  //比赛列表

export const contestSave = data => createAPI('/contest/save', 'post', data)  //比赛列表
export const contestUpdate = data => createAPI('/contest/update', 'put', data)  //比赛列表
export const getDetail = data => createParamsAPI(`/contest/detail/${data.id}`, 'post', data)  // 查询比赛详细信息
export const deleteById = data => createAPI(`/contest/delete/${data.id}`, 'delete', data)  // 删除比赛


export const updateRegisterUser = data => createParamsAPI(`/contest/register/updateUser`,'put',data); //提醒更新register
export const contesResgister = data => createAPI(`/contest/register/select/${data.id}`, 'post', data)  //查询登录用户的报名信息
export const getContestRegisterSearch = data => createParamsAPI(`/contest/register/search`, 'post', data)  //查询登录用户的报名信息
export const saveRegister = data => createAPI(`/contest/register/save`, 'post', data)  //查询登录用户的报名信息
export const cancelRegister = data => createParamsAPI(`/contest/register/cancel/${data.id}`, 'delete', data)  //取消报名
export const updateRegister = data => createAPI(`/contest/register/update`,'put',data); //更新register


//题目展示

export const getProblemOneById = data => createAPI(`/contest/problem/detail/${data.id}`, 'post', data)  //查看单个题目
export const contestSubmitSaveApi = data => createAPI('/contest/problem/submit', 'post', data)  //提交保存

//榜单
export const getRank = data => createParamsAPI(`/record/list/${data.id}`, 'post', data)  //查看榜单

export const getProgress = data => createParamsAPI(`/record/progress`, 'post', data)  //统计

//比赛最多过题数
export const getContestRank = data => createParamsAPI(`/record/accept/rank`,'post',data);

//获取比赛通知
export const getNewAnnouncement = data => createParamsAPI(`/announcement/new`,'post',data);
export const getAnnouncementList = data => createParamsAPI(`/announcement/search`,'post',data);
export const saveAnnouncement = data => createAPI(`/announcement/save`,'post',data);
export const deleteAnnouncement = data => createAPI(`/announcement/delete/${data.id}`,'delete',data);

//榜单导出
export const downRank = data => createFileAPI(`/record/download/rank/${data.id}`, 'post', data)  //榜单导出
